<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>员工花名册</title>
<script type="text/javascript" src="static/easyui/jquery.min.js"></script>
<script type="text/javascript" src="static/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript" src="static/easyui/locale/easyui-lang-zh_CN.js"></script>
<link rel="stylesheet" href="static/easyui/themes/icon.css">
<link rel="stylesheet" href="static/easyui/themes/metro/easyui.css">
<style type="text/css">
	a{
		text-decoration:none;
	}
	ul li{
		list-style: none;
	}
	/* 新增员工按钮 */
	#add-staff{
		color: #19AA8D;
		border:1px solid #1AB394;
	}
	.staff-bianji{
		color: #19AA8D;
		border:1px solid #1AB394;
	}
	.staff-lizhi{
		color: red;
		border:1px solid #1AB394;
	}
	/* 薪资的信息查询 */
	.staff-xzxx{
		color: #19AA8D;
		border:1px solid #1AB394;
	}
</style>
</head>
<body>
	<script type="text/javascript">
	/* 打开编辑窗口里面的数据 */
	function deitstaff(staff_id){
			alert(staff_id);
			//初始化表单
			$.ajax({
				url:"selecthrstaff",
				type:"post",
				data:{"staff_id":staff_id},
				success:function(data){
					$("#content-admin").panel('open').panel('refresh','hr-xq');
				}
			});
			
		}
		$(function(){
			$('#staff-table').datagrid({
			    url:'zaizhistaff',
			    columns:[[
					{field:'staff_id',checkbox:true,title:'员工编号',width:100,align:'center'},
					{field:'Staff_name',title:'员工名称',width:150,align:'center'},
					{field:'depart_name',title:'部门',width:150,align:'center'},
					{field:'Staff_sex',title:'性别',width:150,align:'center',
						formatter:function(value,row,index){
			                 if(value==1){
			                    return '男';
			                 }else if(value==2){
			                	 return '女';
			                 }
			              }	
					},
					{field:'Staff_Political',title:'政治面貌',width:150,align:'center',
						formatter:function(value,row,index){
			                 if(value==1){
			                    return '党员';
			                 }else if(value==2){
			                	 return '预备党员';
			                 }else if(value==3){
			                	 return '民主党派';
			                 }else if(value==4){
			                	 return '团员';
			                 }else if(value==5){
			                	 return '群众';
			                 }else if(value==6){
			                	 return '其他';
			                 }
			              }		
					},
					{field:'Staff_sfzz',title:'是否在职',width:150,align:'center',
						loadFilter: function(data){
							console.log("在职id:"+data);
							if (data==1){
								return "是";
							} else {
								return "否";
							}
						},	
					},
					{field:'Dateentry',title:'入职日期',width:150,align:'center'},
					{field:'caozuo',title:'操作',width:150,align:'center',
						formatter: function(value,row,index){
							return "<input type='button' onclick='deitstaff("+row['staff_id']+")'  style='width: 45px;height: 20px;font-size:12px;border-radius:4px;margin-right:5px;color:#fff;background-color:#18A689;border:1px solid #18A689;' value='查看'/>";
						},
					}
			    ]],
			    pagination:true,
			    pageNumber:1,
			    pageSize:5,
			    pageList:[5,10,15]
			});
			
		});
		
		function ss(staff_name,name){
			alert(staff_name);
			$('#staff-table').datagrid({
			    url:'select-mhcx',
			    queryParams:{
			    	staff_name:staff_name
	    			
	    		},
			    columns:[[
					
			    {field:'staff_id',checkbox:true,title:'员工编号',width:100,align:'center'},
				{field:'staff_name',title:'员工名称',width:150,align:'center'},
				{field:'depart_name',title:'部门',width:150,align:'center'},
				{field:'staff_sex',title:'性别',width:150,align:'center',
					formatter:function(value,row,index){
		                 if(value==1){
		                    return '男';
		                 }else if(value==2){
		                	 return '女';
		                 }
		              }	
				},
				{field:'staff_Political',title:'政治面貌',width:150,align:'center',
					formatter:function(value,row,index){
		                 if(value==1){
		                    return '党员';
		                 }else if(value==2){
		                	 return '预备党员';
		                 }else if(value==3){
		                	 return '民主党派';
		                 }else if(value==4){
		                	 return '团员';
		                 }else if(value==5){
		                	 return '群众';
		                 }else if(value==6){
		                	 return '其他';
		                 }
		              }		
				},
				{field:'staff_sfzz',title:'是否在职',width:150,align:'center',
					/* loadFilter: function(data){
						console.log("在职id:"+data);
						if (data==1){
							return "是";
						} else {
							return "否";
						}
					},	 */
				},
				{field:'dateentry',title:'入职日期',width:150,align:'center'},
				{field:'caozuo',title:'操作',width:150,align:'center',
					formatter: function(value,row,index){
						return "<input type='button' onclick='deitstaff("+row['staff_id']+")'  style='width: 45px;height: 20px;font-size:12px;border-radius:4px;margin-right:5px;color:#fff;background-color:#18A689;border:1px solid #18A689;' value='修改'/>";
					},
				}
		    ]],
			    pagination:true,
			    pageNumber:1,
			    pageSize:5,
			    pageList:[5,10,15]
			});
		}
		function add(text){
			$("#content-admin").panel({
				href:text
			});
		}
		function addentry(){
			$("#content-admin").panel('open').panel('refresh','hr-informationxz');
		}
	</script>
	<input class="easyui-searchbox" style="width:300px" data-options="searcher:ss,prompt:'根据员工编号、员工名称、部门名称'"></input>
	<table id="staff-table" class="easyui-datagrid" style="height: 560px;">   
	</table>  
	
</body>
</html>